From 70200ff2c9ac7eaa7328097402d6afe7bfe2caac Mon Sep 17 00:00:00 2001 From: mseri Date: Fri, 28 Aug 2015 10:28:17 +0100 Subject: [PATCH] Improved fix for the issue #1942 --- src/cargo/ops/cargo_run.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cargo/ops/cargo_run.rs b/src/cargo/ops/cargo_run.rs index 6b9d285d7..419a7ab15 100644 --- a/src/cargo/ops/cargo_run.rs +++ b/src/cargo/ops/cargo_run.rs @@ -48,10 +48,10 @@ pub fn run(manifest_path: &Path, let compile = try!(ops::compile(manifest_path, options)); let exe = &compile.binaries[0]; let exe = match util::without_prefix(&exe, config.cwd()) { - Some(path) => if path.as_os_str() == path.file_name().unwrap() { &**exe } - else { path }, // workaround for being able to use - // `cargo run` from the executable path itself - None => &**exe, + Some(path) if path.file_name() == Some(path.as_os_str()) + => Path::new(".").join(path).to_path_buf(), + Some(path) => path.to_path_buf(), + None => exe.to_path_buf(), }; let mut process = try!(compile.target_process(exe, &root)) .into_process_builder(); -- 2.30.2